<!DOCTYPE html>
<html>
<head lang="en">
  <meta charset="UTF-8">
  <title></title>
</head>

<style>
  .container{
    width: 80%;
    margin: 50px auto;
  }
</style>
<body>
<div class="container">

  <input type="text" placeholder="输出验证码"  id="code">
  <button id="sub">提交</button>
  <br>
  <textarea id="result"></textarea>

</div>
<script src="zepto.min.js"></script>
<script>

  $(document).ready(function(){
    $("#sub").click(function(){

      var code = $("#code").val();
      if(!code) return;
      console.log(1);
      $.ajax({
        type: 'GET',
        url: 'http://localhost:8008/api/code/' + code,
        dataType: 'jsonp',
        success: function(data){
          $("#result").val(JSON.stringify(data))
        },
        error: function(xhr, type){
          alert('Ajax error!')
        }
      })
    })
  })

</script>
</body>
</html>